<template>
  <div class="look_pingjia">
    <!-- 这是查看评价页 -->
    <div class="pingjia">
      <!-- 这是订单评价页面 -->
      <!-- 书写标题头 -->
      <div class="order_title">
        <span class="one" @click="tuihou">&lt;</span>
        <span>评分</span>
      </div>
      <!-- 订单信息部分 -->
      <div class="cont_one">
        <div class="cont_tit">
          <van-icon name="orders-o" />
          <span>订单信息</span>
        </div>
        <div class="cont_body">
          <ul>
            <li>
              <span>商品</span>
              <span>{{ contVal.prodName }}</span>
            </li>
            <li>
              <span>发货时间</span>
              <span>{{ contVal.sendTime }}</span>
            </li>
            <li>
              <span>到达时间</span>
              <span>{{ contVal.receiveTime }}</span>
            </li>
          </ul>
        </div>
      </div>
      <!-- 服务评价部分 -->
      <div class="cont_two">
        <div class="cont_tit">
          <van-icon name="orders-o" />
          <span>服务评价</span>
        </div>
        <!-- 评价的具体模块 -->
        <div class="pingfen">
          <div class="Ping_list">
            <span>描述相符</span>
            <ul>
              <li v-for="(item, index) in 5" :key="index">
                <img
                  :src="
                    index <= contVal.prodConformityPoint ? srcImgTwo : srcImgOne
                  "
                  alt=""
                />
              </li>
            </ul>
            <span>{{ contVal.prodConformityPoint * 2 }}分</span>
          </div>
          <div class="Ping_list">
            <span>物流速度</span>
            <ul>
              <li v-for="(item, index) in 5" :key="index">
                <img
                  :src="
                    index <= contVal.logisticsSpeedPoint
                      ? srcImgThree
                      : srcImgOne
                  "
                  alt=""
                />
              </li>
            </ul>
            <span>{{ contVal.logisticsSpeedPoint * 2 }}分</span>
          </div>
          <div class="Ping_list">
            <span>服务质量</span>
            <ul>
              <li v-for="(item, index) in 5" :key="index">
                <img
                  :src="
                    index <= contVal.serviceQualityPoint
                      ? srcImgFour
                      : srcImgOne
                  "
                  alt=""
                />
              </li>
            </ul>
            <span>{{ contVal.serviceQualityPoint * 2 }}分</span>
          </div>
        </div>
      </div>
      <!-- 输入评论模块 -->
      <textarea name="" id="" v-model="contVal.comment"></textarea>
    </div>
  </div>
</template>

<script>
import { PingLunXiangQing } from "@/request/api";
export default {
  data() {
    return {
      // 星星的样式
      srcImgOne: require("@/assets/pingfen-hui.png"),
      srcImgTwo: require("@/assets/pingfen-huang.png"),
      srcImgThree: require("@/assets/pingfen-cheng.png"),
      srcImgFour: require("@/assets/pingfen-hong.png"),
      contVal: "",
    };
  },
  created() {
    PingLunXiangQing({
      serialNo: this.$route.query.id,
    }).then((res) => {
      console.log(res);
      this.contVal = res.data;
    });
  },
  methods: {
    tuihou() {
      this.$router.go(-1);
    },
  },
};
</script>
 
<style lang = "less" scoped>
.look_pingjia {
  /* 页面的总样式 */
  min-height: 100%;
  width: 100%;
  background-color: #efefef;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 4;
  /* 标题头的样式 */
  .order_title {
    width: 100%;
    height: 0.5rem;
    background-color: #003399;
    text-align: center;
    line-height: 0.5rem;
    color: white;
    font-size: 0.18rem;
    padding-top: 0.1rem;
    .one {
      float: left;
      margin-left: 0.2rem;
    }
  }
  /* 订单信息的样式 */
  .cont_one {
    width: 100%;
    background-color: white;
    .cont_tit {
      width: 100%;
      background-color: #f5fafe;
      padding: 0.1rem 0.2rem;
      font-size: 0.16rem;
      color: #003399;
    }
    .van-icon {
      vertical-align: -0.02rem;
      margin-right: 0.1rem;
    }
    /* 商品信息样式 */
    .cont_body {
      width: 100%;
      padding: 0.2rem;
      box-sizing: border-box;
      background-color: white;
      ul {
        li {
          line-height: 0.2rem;
          display: flex;
          justify-content: space-between;
          span {
            &:nth-child(1) {
              flex: 2;
              color: #aaa;
            }
            &:nth-child(2) {
              flex: 10;
            }
          }
        }
      }
    }
  }
  /* 服务评价部分样式 */
  .cont_two {
    width: 100%;
    background-color: white;
    margin-top: 0.1rem;
    /* 标题的样式 */
    .cont_tit {
      width: 100%;
      background-color: #f5fafe;
      padding: 0.1rem 0.2rem;
      font-size: 0.16rem;
      color: #003399;
    }
    .van-icon {
      vertical-align: -0.02rem;
      margin-right: 0.1rem;
    }
    .pingfen {
      width: 100%;
      padding: 0 0.2rem;
      box-sizing: border-box;
      .Ping_list {
        display: flex;
        line-height: 0.2rem;
        line-height: 50px;
        justify-content: space-between;
        border-bottom: 1px solid #ddd;
        ul {
          li {
            float: left;
            margin-right: 0.05rem;
            height: 0.5rem;
            vertical-align: center;
            img {
              height: 0.3rem;
              margin-top: 10px;
            }
          }
        }
      }
    }
  }
  /* 输入评论样式 */
  textarea {
    width: 100%;
    border: 0;
    margin-top: 0.1rem;
    height: 1rem;
  }
  /* 提交评论按钮样式 */
  .cont_btn {
    position: fixed;
    bottom: 0;
    height: 0.6rem;
    width: 100%;
    background-color: white;
    padding: 0 0.2rem;
    box-sizing: border-box;
    .van-button {
      border-radius: 0.25rem;
      margin-top: 0.05rem;
    }
  }
}
</style>